package com.mubolg.autoconfigure;

import com.mubolg.properties.AppSettingProperties;
import com.mubolg.template.AppWeChatTemplate;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@EnableConfigurationProperties({AppSettingProperties.class})
public class WaChatAutoConfiguration   {
    @Bean
    @ConditionalOnMissingBean(name = "AppWeChatTemplate")
    public AppWeChatTemplate appWeChatTemplate(AppSettingProperties appSettingProperties){
        AppWeChatTemplate appWeChatTemplate = new AppWeChatTemplate(appSettingProperties);
        return appWeChatTemplate;
    }
}
